package org.mock.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.mock.dto.SabreOrderBookingDTO;
import org.mock.entity.SabreHotelDetail;
import org.mock.entity.SabreOrderCancelBooking;
import org.mock.mapper.SabreOrderCancelBookingMapper;
import org.mock.service.SabreOrderCancelBookingService;
import org.mock.dto.SabreOrderCancelBookingDTO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.mock.common.Condition;
import org.mock.utils.BeanCopyUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import cn.hutool.core.util.StrUtil;

import java.util.List;

/**
 * sabre取消订单 服务实现类
 *
 * @author AI
 * @since 2025-07-02
 */
@Service
@AllArgsConstructor
@Slf4j
public class SabreOrderCancelBookingServiceImpl implements SabreOrderCancelBookingService {

    protected SabreOrderCancelBookingMapper sabreOrderCancelBookingMapper;

    @Override
    public SabreOrderCancelBooking getOne(SabreOrderCancelBookingDTO dto) {
        List<SabreOrderCancelBooking> list = sabreOrderCancelBookingMapper.selectList(Condition.getQueryWrapper(BeanCopyUtils.copy(dto, SabreOrderCancelBooking.class)));
        if (CollUtil.isEmpty(list)) {
            return null;
        } else {
            return list.get(0);
        }
    }

    @Override
    public SabreOrderCancelBookingDTO handleRequest(JSONObject request) {
        log.info("[cancelOrder] 请求：{}", request);

        SabreOrderCancelBookingDTO dto = new SabreOrderCancelBookingDTO();

        return dto;
    }

    @Override
    public SabreOrderCancelBookingDTO handleQueryWrapper(SabreOrderCancelBookingDTO originalQuery) {
        return originalQuery;
    }

    @Override
    public String handleData(SabreOrderCancelBooking data, SabreOrderCancelBookingDTO originalQuery) {
        return data.getResponse();
    }
}
